//
//  YIem_FindDetail_Share_ViewController.m
//  B段_开眼
//
//  Created by YIem on 16/4/25.
//  Copyright © 2016年 Howie. All rights reserved.
//

#import "YIem_FindDetail_Share_ViewController.h"

@interface YIem_FindDetail_Share_ViewController ()<UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray *dataArr;

@end

@implementation YIem_FindDetail_Share_ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.dataArr = [NSMutableArray array];
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 40, self.view.frame.size.width, self.view.frame.size.height - 40) style:UITableViewStylePlain];
    //    self.tableView.backgroundCorlor = [UIColor greenColor];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.separatorStyle = UITableViewCellSelectionStyleNone;
    [self.view addSubview:self.tableView];

    [self.tableView registerClass:[YIem_FindDetail_ShareTableViewCell class] forCellReuseIdentifier:@"YIem_FindDetail_ShareTableViewCell"];
    
    [self dataBase];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.dataArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    YIem_FindDetail_ShareTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YIem_FindDetail_ShareTableViewCell" forIndexPath:indexPath];
    cell.model = self.dataArr[indexPath.row];
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 200;
}


- (void)dataBase
{

    //**/
    [YIem_FindDetailViewModel getDataWithPage:self.urlStr andUpdate:YES andBlock:^(NSMutableArray *arr, NSString *str, NSString *aa) {
        //        NSLog(@"%@", arr);
        self.dataArr = arr;
//        NSLog(@"%@", self.dataArr);
        
        [self.tableView reloadData];
    }];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
